{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Matlab转python"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "m的类型的ml.array  \n",
    "```python\n",
    "import numpy as np\n",
    "p = np.array(m)\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "m的类型的ml.array, array的容易是复数double   \n",
    "\n",
    "```python\n",
    "import numpy as np\n",
    "p = np.array(m, dtype=complex)\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# python转Matlab"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "p是float，要转成double\n",
    "```python\n",
    "import matlab\n",
    "m = matlab.double(p)\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "p是复数，要转成double\n",
    "```python\n",
    "import matlab\n",
    "m = matlab.double(p, is_complex=True)\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "p是numpy,要转成double\n",
    "```python\n",
    "import matlab\n",
    "m = matlab.double(p.tolist())\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
